#include "zombie.h"

zombie::zombie()
{
    //僵尸资源加载
    m_enemy.load(ENEMY_PATH);
    //僵尸位置
    m_x = 0;
    m_y = 0;
    //僵尸状态
    m_free=true;
    //僵尸速度
    m_speed=ENEMY_SPEED;
    m_Rect.setWidth(m_enemy.width());
    m_Rect.setHeight(m_enemy.height());
    m_Rect.moveTo(m_x,m_y);
}
void zombie::updatePosition(){
    if(m_free){
        return;
    }
    m_x -=m_speed;
    m_Rect.moveTo(m_x,m_y);
    //如果超出屏幕 重置空闲状态
    if(m_x>=900){
        m_free=true;
    }
}
